import React from 'react';
import {useSelector, useDispatch} from '../react-redux';
import {DECREMENT3, INCREMENT3} from '../store/action-types';

function Counter3(){
  const dispatch = useDispatch();
  const state = useSelector(state => state.counter3);
  /*const state = useSelector(state => {
    counter1: state.counter1,
    counter2: state.counter2
    something: 'something'
  });*/

  console.log('counter3 render');

  return (
    <div>
      <p>{state.number}</p>
      <button onClick={()=>dispatch({type:INCREMENT3})}>+</button>
      <button onClick={()=>dispatch({type:DECREMENT3})}>-</button>
    </div>
  )
}

export default Counter3;
